<template>
  <div>
    <input v-model.lazy="username" />
    <span>{{ msg }}</span>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "App",
  data() {
    return {
      username: "",
      msg: "",
    };
  },
  watch: {
    async username(newVal, oldVal) {
      console.log(newVal, oldVal);
      if (newVal === "") return (this.msg = "");
      const result = await axios.get(
        "http://www.itcbc.com:3006/api/finduser/" + newVal
      );
      this.msg = result.data.message;
    },
  },
};
</script>